package com.banciyuan.bcywebview.biz.pc.zone.smooth.decoration;

import android.content.Context;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.banciyuan.bcywebview.utils.common.UIUtils;

/**
 * Created by squall on 2017/3/30.
 */

public class PersonDecoration extends RecyclerView.ItemDecoration {

    private Context mContext;
    private int type;
    private Paint paint;

    public PersonDecoration(Context mContext) {
        this.mContext = mContext;
        this.paint = new Paint();
        this.paint.setColor(Color.WHITE);
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        int position = parent.getChildAdapterPosition(view);
        type = parent.getAdapter().getItemViewType(position);
        if (type >= 30 && type <= 36) {
            if ((position - 1) % 3 == 1) {
                outRect.right = UIUtils.dip2px(2, mContext);
            } else if ((position - 1) % 3 == 2) {
                outRect.left = UIUtils.dip2px(1, mContext);
                outRect.right = UIUtils.dip2px(1, mContext);
            } else if ((position - 1) % 3 == 0) {
                outRect.left = UIUtils.dip2px(2, mContext);
            }
            outRect.bottom = UIUtils.dip2px(4, mContext);
        }
    }


}
